package com.student.liu.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.student.liu.cache.RedisCache;
import com.student.liu.entity.ShopCar;
import org.apache.ibatis.annotations.CacheNamespace;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
@CacheNamespace(implementation = RedisCache.class, eviction = RedisCache.class)  //括号里的设置目的是将mybatis的二级缓存存储在Redis里面
public interface IShopCarMapper extends BaseMapper<ShopCar> {
    @Select("SELECT goods.name,goods.image,goods.price ,shop_car.inventory" +
            "FROM goods JOIN shop_car on shop_car.goods_id = goods.id " +
            "WHERE shop_car.user_id = ${userId};")
    ShopCar SelectTypeId(@Param("userId") Integer userId);
}
